#include "add_order.h"
#include "ui_add_order.h"
#include "main.h"
#include <iostream>
add_order::add_order(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::add_order)
{
    ui->setupUi(this);
}

add_order::~add_order()
{
    delete ui;
}

void add_order::on_buttonBox_accepted()
{
    std::string gn = ui->lineEdit->text().toStdString();   //商品名称
    std::string gp = ui->lineEdit_2->text().toStdString(); //商品价格
    std::string id = ui->lineEdit_3->text().toStdString(); //订单编号
    std::string addr = ui->lineEdit_4->text().toStdString(); //收货地址


    order_for_goods *item=o_first;
    while(item->next){
        item = item->next;
    }
    item->next = new order_for_goods(gn.c_str(), gp.c_str(), id.c_str(), addr.c_str());
    item->next->next = NULL;
}
